<?php

/**
 * Contains main entry point for team player.
 *
 * LICENSE: MIT
 *
 * @author Peter Pippinger
 * @category PP
 * @package PP_Teamplayer
 * @copyright Copyright (c) 2015 Peter Pippinger
 * @license http://opensource.org/licenses/MIT
 * @version 1.1.0
 * @since Class exists since release 1.0.0
 */

// Start session, if not allready started.
if (session_id() == "") {
	session_start();
}

// Include settings.
require_once "settings.php";

// Auto load classes.
spl_autoload_register(function ($class) {
	$classes = array(
		"Log" => "/Lib/Log/Log.php",
		"Application" => "/Lib/Application/Application.php",
		"Ajax" => "/Lib/Ajax/Ajax.php",
		"Mvc" => "/Lib/Mvc/Mvc.php",
		"View" => "/Lib/Mvc/View.php"
	);
	
	$filename = ROOT_PATH . $classes[$class];
	
	if (is_file($filename))
		require_once $filename;
	else
		debug_print_backtrace();
});

// Error handling.
require_once "Lib/Error/handler.php";

// Initialize application.
Application::init(array());

// Execute ajax request.
Ajax::executeRequest();

// Start application.
echo Mvc::modul("Teamplayer")->output();
